home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / System / Swatch / Development / swatch 1.7 / display.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-05  |  3.2 KB  |  169 lines  |  [TEXT/KAHL]

  1. /**
  2.  
  3.     display.h
  4.     Copyright (c) 1990-1992, joe holt
  5.  
  6.  **/
  7.  
  8.  
  9. #ifndef __display__
  10. #define __display__
  11.  
  12. /*******************************************************************************
  13.  **
  14.  **    Headers
  15.  **
  16.  **/
  17.  
  18. #ifndef __ctypes__
  19. #include "ctypes.h"
  20. #endif
  21. #ifndef __linked_list__
  22. #include "linked_list.h"
  23. #endif
  24.  
  25.  
  26. /*******************************************************************************
  27.  **
  28.  **    Public Constants
  29.  **
  30.  **/
  31.  
  32. #define BLACK_COLOR                0
  33. #define WHITE_COLOR                1
  34. #define HEADER_COLOR            2
  35. #define HEADER_BORDER_COLOR        3
  36. #define NAME_COLOR                4
  37. #define SIZE_COLOR                5
  38. #define HEAP_BORDER_COLOR        6
  39. #define HEAP_FREE_COLOR            7
  40. #define HEAP_LOCKED_COLOR        8
  41. #define HEAP_UNLOCKED_COLOR        9
  42. #define FREE_COLOR                10
  43. #define BACK_COLOR                11
  44. #define HEAP_PURGEABLE_COLOR    12
  45.  
  46.  
  47. #define MAX_COLUMNS                6
  48.  
  49. enum {
  50.     colUpdating        = 1 << 0,
  51.     colName            = 1 << 1,
  52.     colSize            = 1 << 2,
  53.     colFree            = 1 << 3,
  54.     colIslands        = 1 << 4,
  55.     colHeap            = 1 << 5
  56. };
  57.  
  58.  
  59. #define BORDER_TOP                0
  60. #define BORDER_BOTTOM            16
  61. #define CELL_HEIGHT                16
  62.  
  63.  
  64. enum {
  65.     UPDATE_UPDATING                = colUpdating,
  66.     UPDATE_NAME                    = colName,
  67.     UPDATE_SIZE                    = colSize,
  68.     UPDATE_FREE                    = colFree,
  69.     UPDATE_ISLANDS                = colIslands,
  70.     UPDATE_HEAP                    = colHeap,
  71.     UPDATE_SELECTION            = colHeap << 1,
  72.     UPDATE_HEADER                = colHeap << 2,
  73.     UPDATE_HEAP_SCALE            = colHeap << 3,
  74.     UPDATE_BOTTOM                = colHeap << 4,
  75.     FORCE_UPDATE                = 32768
  76. };
  77.  
  78. enum {
  79.     NO_UPDATE = 0,
  80.  
  81.     UPDATE_COLUMNS =            UPDATE_UPDATING |
  82.                                 UPDATE_NAME |
  83.                                 UPDATE_SIZE |
  84.                                 UPDATE_FREE |
  85.                                 UPDATE_ISLANDS |
  86.                                 UPDATE_HEAP |
  87.                                 UPDATE_SELECTION,
  88.  
  89.     UPDATE_IDLE_COLUMNS =        UPDATE_SIZE |
  90.                                 UPDATE_FREE |
  91.                                 UPDATE_ISLANDS |
  92.                                 UPDATE_HEAP |
  93.                                 UPDATE_SELECTION,
  94.  
  95.     UPDATE_COLUMNS_AND_BORDER =    UPDATE_COLUMNS |
  96.                                 UPDATE_HEADER |
  97.                                 UPDATE_HEAP_SCALE,
  98.  
  99.     UPDATE_EVERYTHING =            UPDATE_COLUMNS_AND_BORDER |
  100.                                 UPDATE_BOTTOM
  101. };
  102.  
  103. #define MBOX_EMPTY                        0
  104. #define MBOX_HEAP_ADDRESS                1
  105. #define MBOX_ADDRESS                    2
  106.  
  107. #define MBOX_ERASE                        1
  108. #define MBOX_FRAME_AND_CONTENTS            2
  109. #define MBOX_CONTENTS                    3
  110.  
  111. #define DISPLAY_ALL                        -1
  112.  
  113. #define MIN_HEAP_SCALE            8
  114. #define MAX_HEAP_SCALE            4194304
  115.  
  116.  
  117. /*******************************************************************************
  118.  **
  119.  **    Public Variables
  120.  **
  121.  **/
  122.  
  123. typedef struct {
  124.     int16 left, right;
  125.     struct _t_cell *cell;
  126. } column_t;
  127.  
  128. typedef struct _t_cell {
  129.     int16 type;
  130.     ProcPtr draw;
  131.     int16 width, space;
  132.     int16 name;
  133. } cell_t;
  134.  
  135. typedef struct {
  136.     int16 top, bottom;
  137.     int16 max_columns;
  138.     column_t column[MAX_COLUMNS];
  139. } row_t;
  140.  
  141. extern Boolean Use_color;
  142.  
  143.  
  144. /*******************************************************************************
  145.  **
  146.  **    Public Functions
  147.  **
  148.  **/
  149.  
  150. void Display_init( void );
  151. void Display_new_row_arrangement( int16 max_columns, int16 *column_types );
  152. void Display_new_row( l_elem_t h );
  153. void Display_update_row_tops( void );
  154.  
  155. int16 Display_row( int16 update, l_elem_t h );
  156. void Display_lines( int16 update, int16 line_start, int16 line_end );
  157.  
  158. void Display_header( int16 update );
  159. column_t *Display_find_column( struct _t_Heap_info *hi, int16 cell_type );
  160.  
  161. void Check_color_usage( void );
  162. void Set_fore_color_or_pattern( int16 color );
  163. void Set_fore_color( int16 color );
  164. void Set_back_color( int16 color );
  165. void Set_cursor( void );
  166. unsigned char *MBox_text( void );
  167.  
  168. #endif
  169.